/**
 *  注册画布组件
 */
import { registerNode } from '@topology/core';
import {
  flowData,
  flowDataAnchors,
  flowDataIconRect,
  flowDataTextRect,
  flowSubprocess,
  flowSubprocessIconRect,
  flowSubprocessTextRect,
  flowDb,
  flowDbIconRect,
  flowDbTextRect,
  flowDocument,
  flowDocumentAnchors,
  flowDocumentIconRect,
  flowDocumentTextRect,
  flowInternalStorage,
  flowInternalStorageIconRect,
  flowInternalStorageTextRect,
  flowExternStorage,
  flowExternStorageAnchors,
  flowExternStorageIconRect,
  flowExternStorageTextRect,
  flowQueue,
  flowQueueIconRect,
  flowQueueTextRect,
  flowManually,
  flowManuallyAnchors,
  flowManuallyIconRect,
  flowManuallyTextRect,
  flowDisplay,
  flowDisplayAnchors,
  flowDisplayIconRect,
  flowDisplayTextRect,
  flowParallel,
  flowParallelAnchors,
  flowComment,
  flowCommentAnchors,
} from '@topology/flow-diagram';

import {
  activityFinal,
  activityFinalIconRect,
  activityFinalTextRect,
  swimlaneV,
  swimlaneVIconRect,
  swimlaneVTextRect,
  swimlaneH,
  swimlaneHIconRect,
  swimlaneHTextRect,
  fork,
  forkHAnchors,
  forkIconRect,
  forkTextRect,
  forkVAnchors,
} from '@topology/activity-diagram';
import {
  simpleClass,
  simpleClassIconRect,
  simpleClassTextRect,
  interfaceClass,
  interfaceClassIconRect,
  interfaceClassTextRect,
} from '@topology/class-diagram';

import {
  lifeline,
  lifelineAnchors,
  lifelineIconRect,
  lifelineTextRect,
  sequenceFocus,
  sequenceFocusAnchors,
  sequenceFocusIconRect,
  sequenceFocusTextRect,
} from '@topology/sequence-diagram';

export const canvasRegister = () => {
  registerNode(
    'flowData',
    flowData,
    flowDataAnchors,
    flowDataIconRect,
    flowDataTextRect,
  );
  registerNode(
    'flowSubprocess',
    flowSubprocess,
    undefined,
    flowSubprocessIconRect,
    flowSubprocessTextRect,
  );
  registerNode('flowDb', flowDb, undefined, flowDbIconRect, flowDbTextRect);
  registerNode(
    'flowDocument',
    flowDocument,
    flowDocumentAnchors,
    flowDocumentIconRect,
    flowDocumentTextRect,
  );
  registerNode(
    'flowInternalStorage',
    flowInternalStorage,
    undefined,
    flowInternalStorageIconRect,
    flowInternalStorageTextRect,
  );
  registerNode(
    'flowExternStorage',
    flowExternStorage,
    flowExternStorageAnchors,
    flowExternStorageIconRect,
    flowExternStorageTextRect,
  );
  registerNode(
    'flowQueue',
    flowQueue,
    undefined,
    flowQueueIconRect,
    flowQueueTextRect,
  );
  registerNode(
    'flowManually',
    flowManually,
    flowManuallyAnchors,
    flowManuallyIconRect,
    flowManuallyTextRect,
  );
  registerNode(
    'flowDisplay',
    flowDisplay,
    flowDisplayAnchors,
    flowDisplayIconRect,
    flowDisplayTextRect,
  );
  registerNode(
    'flowParallel',
    flowParallel,
    flowParallelAnchors,
    undefined,
    undefined,
  );
  registerNode(
    'flowComment',
    flowComment,
    flowCommentAnchors,
    undefined,
    undefined,
  );

  // activity
  registerNode(
    'activityFinal',
    activityFinal,
    undefined,
    activityFinalIconRect,
    activityFinalTextRect,
  );
  registerNode(
    'swimlaneV',
    swimlaneV,
    undefined,
    swimlaneVIconRect,
    swimlaneVTextRect,
  );
  registerNode(
    'swimlaneH',
    swimlaneH,
    undefined,
    swimlaneHIconRect,
    swimlaneHTextRect,
  );
  registerNode('forkH', fork, forkHAnchors, forkIconRect, forkTextRect);
  registerNode('forkV', fork, forkVAnchors, forkIconRect, forkTextRect);

  // class
  registerNode(
    'simpleClass',
    simpleClass,
    undefined,
    simpleClassIconRect,
    simpleClassTextRect,
  );
  registerNode(
    'interfaceClass',
    interfaceClass,
    undefined,
    interfaceClassIconRect,
    interfaceClassTextRect,
  );

  // sequence
  registerNode(
    'lifeline',
    lifeline,
    lifelineAnchors,
    lifelineIconRect,
    lifelineTextRect,
  );
  registerNode(
    'sequenceFocus',
    sequenceFocus,
    sequenceFocusAnchors,
    sequenceFocusIconRect,
    sequenceFocusTextRect,
  );
};
